package com.city.itis.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.city.itis.dao.UserDao;
import com.city.itis.domain.User;
import com.city.itis.service.UserService;

/**
 * 用户业务层实现类
 * @author WY
 *
 */
@Component("userService")
public class UserServiceImpl implements UserService 
{
	private UserDao userDao;
	

	public UserDao getUserDao()
	{
		return userDao;
	}
	@Resource
	public void setUserDao(UserDao userDao) 
	{
		this.userDao = userDao;
	}

	@Override
	public int add(User user)
	{
		return this.userDao.save(user);
	}

	@Override
	public int delete(User user) 
	{
		
		return userDao.delete(user);
	}

	@Override
	public int deleteById(Integer id) 
	{
		return userDao.deleteById(id);
	}

	@Override
	public int modify(User user) 
	{
		return userDao.update(user);
	}

	@Override
	public User getUserById(Integer id) 
	{
		return userDao.getUserById(id);
	}
	
	@Override
	public List<User> findAllById(Integer id) {
		return userDao.findAllById(id);
	}

	@Override
	public List<User> findAll() 
	{
		return userDao.findAll();
	}
	@Override
	public int login(Integer id, String password) 
	{
		return userDao.login(id, password);
	}
	@Override
	public User login(String userId, String password) 
	{
		return userDao.login(userId, password);
	}
	@Override
	public User getUserByUserId(String userId) 
	{
		return this.userDao.getUserByUserId(userId);
	}
	

}
